import { ref } from 'vue'

export function useBirthdayPicker() {
	const selected = ref(Date.now())
	const show = ref(false)

	const open = (value: string) => {
		if (value) {
			selected.value = new Date(value).getTime()
		} else {
			selected.value = Date.now()
		}

		show.value = true
	}

	const close = () => {
		show.value = false
	}

	return {
		selected,
		show,
		open,
		close,
	}
}
